import { Component, OnInit,Input,Output } from '@angular/core';


@Component({
	selector: 'my-Carousel',
	templateUrl: 'Carousel.component.html',
	styleUrls:["Carousel.component.scss"]
})

export class CarouselComponent implements OnInit {
	//切换图片时间间隔
	@Input("Interval")
	public myInterval: number = 1500;
	//图片list{image: `http://valor-software.com/ng2-bootstrap/assets/images/nature/5.jpg`,
	 	// text: "qwer"}
	@Input("imageList")
	public slides;
	//当前位置
	@Output()
	public activeSlideIndex: number;
	//停止在右侧
	public noWrapSlides: boolean = false;
	constructor() { 
	
	}

	ngOnInit() {
		
	}
	public addSlide(): void {
		this.slides.push({
			image: `http://pic11.nipic.com/20101214/213291_155243023914_2.jpg`,
			text: "qwer"
		});
	}
	public removeSlide(index?: number): void {
		const toRemove = index ? index : this.activeSlideIndex;
		this.slides.splice(toRemove, 1);
	}
}